package com.hundsun.yr.universal.p2p.bean.enums;

import java.util.ArrayList;
import java.util.HashMap;

import com.hundsun.yr.universal.p2p.bean.UserPersonalInfo;
import com.hundsun.yr.universal.p2p.bean.enums.base.Enum;
import com.hundsun.yr.universal.p2p.bean.enums.base.LabelEnum;

/**
 * 车辆枚举类
 * 
 * @author tonglj
 * 
 */
public class VehicleEnum extends LabelEnum {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static VehicleEnum YES = new VehicleEnum("YES", "有");
	public static VehicleEnum NO = new VehicleEnum("NO", "无");

	private static HashMap<String, String> mHashMap = new HashMap<String, String>();

	protected VehicleEnum(String name, String lable) {
		super(name, lable, UserPersonalInfo.VEHICLE);
		title = "车辆";
	}

	@SuppressWarnings("unchecked")
	public static ArrayList<LabelEnum> getList() {
		mList.clear();
		mList.addAll(Enum.getEnumList(VehicleEnum.class));
		return mList;
	}

	public static HashMap<String, String> getHashMap() {
		if (mHashMap == null || mHashMap.size() == 0) { // 保证mHashMap只进行一次赋值，只遍历一次mList
			ArrayList<LabelEnum> list = getList();
			for (LabelEnum labelEnum : list) {
				mHashMap.put(labelEnum.getName(), labelEnum.getLable());
			}
		}
		return mHashMap;
	}

}
